<template>
    <!-- 工作台 -->
    <div>
        <el-container>
            <el-aside width="160px">
                <div class="container" style="position: fixed">
                    <portrait></portrait>
                    <el-menu class="el-menu-vertical-demo" background-color="#2c3b5b" text-color="#fff" router
                        :default-active="activeIndex">
                        <div>
                            <el-menu-item index="/Workbench/Index/0">
                                <i class="el-icon-s-claim"></i>
                                <span slot="title">首页</span>
                            </el-menu-item>
                            <el-menu-item index="/Workbench/Order">
                                <i class="el-icon-s-claim"></i>
                                <span slot="title">接单管理</span>
                            </el-menu-item>
                            <el-menu-item index="/Workbench/Calendar/0">
                                <i class="el-icon-s-claim"></i>
                                <span slot="title">服务日历</span>
                            </el-menu-item>
                            <el-menu-item index="/Workbench/Prevent">
                                <i class="el-icon-s-claim"></i>
                                <span slot="title">预防服务</span>
                            </el-menu-item>
                            <el-menu-item index="/Workbench/Company/0">
                                <i class="el-icon-s-claim"></i>
                                <span slot="title">单位管理</span>
                            </el-menu-item>
                        </div>
                    </el-menu>
                </div>
            </el-aside>
            <el-container>
                <el-main>
                    <router-view></router-view>
                </el-main>
            </el-container>
        </el-container>
        <!-- <Information ref="Information"></Information> -->
    </div>
</template>

<script>
import Portrait from '../components/Portrait.vue'
export default {
    components: {
        Portrait,
    },
    data() {
        return {
            activeIndex: "/Workbench/Index/0",
        }
    },
    created() { //页面渲染之前执行

    },
    mounted() {
        console.log(111, this.$route.path)
    },
    watch: {  //监听
        '$route'(to, from) { //路由变化方式，路由发生变化，方法就会执行
            this.init()
            console.log("workbench组件", to)
        }

    },
    methods: {
        init() {
            console.log("页面跳转")
        }
    }
}
</script>

<style>
.el-header {
    z-index: 100;
}

.el-menu {
    border-right: 0px;
}

.el-menu-item {
    font-size: 16px;
    font-weight: 400;
}

.text {
    font-size: 12px;
    color: #879bcc;
    margin: 10px 14px 5px;
    text-overflow: ellipsis;
    text-align: center;
}

.avatar {
    width: 40px;
    margin: auto;
    margin-top: 74px;
}

.container {
    width: 160px;
    left: 0;
    min-height: 100%;
    top: 0;
    /* z-index: 1; */
    background-color: #2c3b5b;
}
</style>